<?php include("header.php"); ?>

<script type="text/javascript">
    function validate()
	{
        var new_password = document.getElementById('new_password');
        var confirm_password = document.getElementById('confirm_password');
		
        if(isEmptyTextBox(new_password, '<?php echo _LB_INVALID_PASSWORD; ?>'))
        {
            return false;
        }
        
        if(new_password.value.length > '<?php echo MAX_LENGTH_PASSWORD; ?>')
        {
            showErrorBubble(new_password, '<?php echo _MSG_PASSWORD_IS_TOO_LONG; ?>');
            return false;
        }
        
        if(new_password.value.length < '<?php echo MIN_LENGTH_PASSWORD; ?>')
        {
            showErrorBubble(new_password, '<?php echo _MSG_PASSWORD_IS_TOO_SHORT; ?>');
            return false;
        }
        
        if(isEmptyTextBox(confirm_password, '<?php echo _LB_INVALID_CONFIRM_PASSWORD; ?>'))
        {
            return false;
        }
        
        if (new_password.value != confirm_password.value) {
            showErrorBubble(confirm_password, '<?php echo _LB_PASSWORD_DOESNT_MATCH; ?>');
            return false;
        }
        
		document.user.submit();
	}

</script>

	<div class="one_center">
		<div class="box_two_third">
			<div class="box_head"><?php echo _LB_CHANGE_PASSWORD; ?></div>
			<div class="box_content" >
				<form action="" name="user" method="post">
				<input type="hidden" id="id" name="id" value="<?php $user->id; ?>"/>
				<input type="hidden" id="act" name="act" value="<?php echo ACT_VALID_EDIT; ?>"/>
				<table cellpadding="0" cellspacing="5px" border="0">
                     <tr>
						<td width="20%"><label><?php echo _LB_NEW_PASSWORD; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="new_password" id="new_password" type="password" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $new_password; ?>"/></td>
					</tr>
					<tr>
						<td width="20%"><label><?php echo _LB_REPEAT_PASSWORD; ?>&nbsp;:&nbsp;<?php echo _LB_REQUIRE_FIELD; ?></label></td>
                        <td><input name="confirm_password" id="confirm_password" type="password" size="<?php echo SIZE_NAME; ?>" maxlength="<?php echo MAX_LENGTH_NAME;?>" value="<?php echo $confirm_password; ?>"/></td>
					</tr>
                    <tr>
					  	<td class="submit" colspan="2" style="padding-top: 10px;">
							  <a id="auto_port_return" class="tribullet" id="btnReturn" href="<?php echo $backlink; ?>"><?php echo _LB_BACK; ?></a>
							  <a id="auto_port_validate" class="tribullet" href="#" onclick="validate()"><?php echo _LB_VALIDATE; ?></a>
						</td>
					</tr>
				</table>
				</form>
			</div>
		</div>
	</div>

<?php include("footer.php"); ?>

